<?php

	require 'config.php';
	require 'init.php';
	if(!empty($_POST['lr_transfer'])){
		$order = CTable('deposit')->select(intval($_POST['order_id']));
		if($order && request('lr_paidby') == $order['lr_account']){
			if($order['money'] == intval(request('lr_amnt'))){
				// update order
				CTable('deposit')->update(array(
					'change_status' => time(),
					'money' => intval(request('lr_amnt')),
					'lr_batch' => request('lr_transfer'),
					'status' => 'Complete',
					'point' => intval(request('lr_amnt'))*101
				),array('id'=>intval($_POST['order_id'])));
				// update point
				$user = CTable('user')->select(array('id'=>request('USER_NAME')));
				CTable('user')->update(array(
					'point'=>$user['point']+intval(request('lr_amnt'))*101
				),array('id'=>request('USER_NAME')));
				// update point user
				CUser::$current->data['point'] = $user['point']+intval(request('lr_amnt'))*101;
			}
		}
	}
	//header("Location: /?page=deposit");
	file_put_contents("./publish/false.txt", print_r($_REQUEST,1));
?>
